package com.project_doctor.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project_doctor.pojo.Role;
import com.project_doctor.pojo.dto.RoleDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 角色Mapper接口
 * @Entity com.project_doctor.pojo.Role
 */
@Mapper
public interface RoleMapper extends BaseMapper<Role> {

    List<RoleDTO> selectRolesWithPermissions();

    RoleDTO selectRoleWithPermissionsById(@Param("roleId") Long roleId);

    void deleteRolePermissions(@Param("roleId") Long roleId);

    void insertRolePermissions(@Param("roleId") Long roleId, @Param("permissionIds") List<Long> permissionIds);

    int insertRole(Role role);

    int updateRole(Role role);

    int deleteRoleById(@Param("roleId") Long roleId);
}